import type { postOrPutType } from "@/constants";
import type { IList, IResult } from "@/types/common";
import { getAxios, commonAxiosJson, deleteAxios } from "@/utils/request.ts";
/* 获取 红包商城 常用物流公司 地址*/
const url = "/back/express";
/* 获取 物流公司信息  */
export const getExpressInfo = <T, D>(params: D): Promise<IResult<IList<T>>> => {
  return getAxios<IList<T>, D>(url, params);
};
/* 新增，修改物流公司信息 */
export const commonExpressInfo = <T, D>(params: D, type: postOrPutType): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url, params, type);
};
/* 删除 物流公司信息 */
export const deleteExpressInfo = <T, D>(params: D): Promise<IResult<T>> => {
  return deleteAxios<T, D>(url, params);
};

/* 获取常用 物流公司信息 */
export const getLogisticsInfo = <T>(): Promise<IResult<T>> => {
  return getAxios<T>(url + "/get-express-list");
};
/*修改物流公司信息 排序 信息 */
export const putExpressSortInfo = <T, D>(params: D): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url + "/update-sort", params, "PUT");
};
